Close
dtSearch Engine API for .NET Framework 2.x-4.x 2024.01
Server::ConvertPath Method

Convert between virtual and local paths.

public String ConvertPath( ref String path, long siteId, ConvertPathFlags flags, ref String tableLocation );
Parameters
Description
path
Path to convert, either a virtual or a local path, depending on the flags
siteId
The id of the web site in IIS (the INSTANCE_ID server variable can be used)
flags
Flags indicating the type of conversion to perform
tableLocation
Registry key where the virtual path mappings are stored

After a search, the SearchResults object contains a list of the files that were retrieved. These files are expressed as local paths, such as c:docssample.doc. For web-based applications, it is usually preferable to report document locations using virtual directory names, such as /docs/sample.doc. Also, when highlighting hits in PDF files or creating direct links to retrieved documents, a virtual directory name is required.  

Internet Information Server stores its mapping between virtual and local paths in the Metabase. Reading this information from the Metabase is time-consuming and requires access rights that may not be available to a process running in the web server context. Therefore, the dtSearch Engine caches this information in the registry, under the key HKEY_LOCAL_MACHINESoftwaredtSearch Corp.dtSearchVirtual Roots. By default, ConvertPath will use the cached table values. Call ConvertPath with the dtsCpRefreshMappings + dtsCpStoreInRegistry flags to update the cached information. (Running dtWebSetup.exe, the dtSearch Web Setup program, will also update this information.)  

If ConvertPath returns a blank string, it means that either (1) the folder passed in does not have a virtual directory associated with it, or (2) the registry tables have not been refreshed since the virtual directory was created.